<template>
	<view class="margin-tb">
		<u-cell-group>
			<u-swipe-action :options="options" @click="edit(company)">
				<u-cell-item icon="home" :title="company.aliasName" :arrow="true" arrow-direction="right" @click="navTo('list?parentId='+company.id)">
					<view slot="label">
						<view>全称：{{ company.orgName }}</view>
						<view>类型：{{ company.orgTypeName }}</view>
						<view>编码：{{ company.orgCode }}</view>
					</view>
				</u-cell-item>
			</u-swipe-action>
		</u-cell-group>
		<u-loadmore status="nomore" bg-color="" class="padding"/>
	</view>
</template>

<script>
export default {
	onLoad: function(option) {
		this.getCompany();
	},
	data() {
		return {
			company: {}, // 公司
			options: [
				{
					text: '修改',
					style: {
						backgroundColor: '#ffaa00'
					}
				}
			]
		};
	},
	methods: {
		navTo: function(url) {
			uni.navigateTo({
				url: url
			});
		},
		getCompany: function() {
			this.$request.get(
				`/admin/sys/org/getCompany`,
				{},
				res => {
					this.company = res.data || {};
				},
				false,
				true,
				true
			);
		},
		edit: function(company) {
			this.navTo(`edit?info=${JSON.stringify(company)}`);
		}
	}
};
</script>

<style lang="scss" scoped></style>
